package com.hc.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hc.common.bean.PageBean;
import com.hc.domain.Category;
import com.hc.domain.User;
import com.hc.query.CategoryVO;
import com.hc.query.CommentVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.hc.mapper.CommentMapper;
import com.hc.domain.Comment;
import com.hc.service.CommentService;

import java.util.List;

/**
 * @author: hecai
 * @date: 2021/11/9 11:17
 * @description: 
 */
@Service
public class CommentServiceImpl implements CommentService{

    @Resource
    private CommentMapper commentMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return commentMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Comment record) {
        return commentMapper.insert(record);
    }

    @Override
    public int insertSelective(Comment record) {
        return commentMapper.insertSelective(record);
    }

    @Override
    public Comment selectByPrimaryKey(Long id) {
        return commentMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Comment record) {
        return commentMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Comment record) {
        return commentMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<Comment> getAllCommentByProjId(Long projId) {
        return commentMapper.getAllCommentByProjId(projId);
    }

    @Override
    public PageBean<Comment> selectPageByCondition(Integer pageNum, Integer pageSize, CommentVO commentVO) {
            Page<Comment> page = PageHelper.startPage(pageNum, pageSize);
            commentMapper.selectCommentsByCondition(commentVO);
            PageBean<Comment> pageBean = PageBean.init(page);
            return pageBean;
        }

}
